package com.example.adapter;

import java.util.List;

import net.tsz.afinal.FinalBitmap;

import com.example.domain.DianYing;
import com.example.mypro.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class Dy_LvAdapter extends BaseAdapter {
	private List<DianYing> list;
	private Context context;

	public Dy_LvAdapter(List<DianYing> list, Context context) {
		this.list = list;
		this.context = context;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		View view = LayoutInflater.from(context).inflate(R.layout.dy_text_item,
				null);
		TextView textView = (TextView) view.findViewById(R.id.dy_tv_title);
		textView.setText(list.get(arg0).getDy_bt());
		TextView textView2 = (TextView) view.findViewById(R.id.dy_tv_jj);
		textView2.setText(list.get(arg0).getDy_jj());
		ImageView imageView=(ImageView) view.findViewById(R.id.dy_iv_tp);
		FinalBitmap.create(context).display(imageView,list.get(arg0).getDy_tp());
		return view;
	}
}
